<?php
// +----------------------------------------------------------------------
// | ThinkCMF [ WE CAN DO IT MORE SIMPLE ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013-2018 http://www.thinkcmf.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: guosheng1987@126.com 
// +----------------------------------------------------------------------
namespace plugins\crawler\service; 

use plugins\crawler\service\CrawlerFenxiangdashiService;
use plugins\crawler\service\CrawlerWeihongbaoService;

class CrawlerServiceFactory 
{   
    /**
     * 构造函数
     *
     */
    public function __construct(){}
    

    /**
     * 服务工厂类，构造服务方法
     * @access public
     * @param  String $siteName 
     * @return mixed $object
     */

    public static function create($siteName) {

        if(empty($siteName) || $siteName == 'fenxiangdashi') {
            return new CrawlerFenxiangdashiService();
        } elseif ($siteName == 'weihongbao') {
            return new CrawlerWeihongbaoService();
        } elseif ($siteName == 'zhidao') {
            return new CrawlerZhidaoService();
        } elseif ($siteName == 'douban') {
            return new CrawlerDoubanService();
        } 
        else {
            //报错
            throw new Exception("Error site type", 1);
        }

    }

}